Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

350
Visualizações
catch response in xml and convert it to JSON [Angular]

am actually interacting with a SOAP webservice which makes a POST request and returns a response with status 200 and an xml file, but when I want to catch that message I receive the following response: "SyntaxError: Unexpected token <in JSON at position 0 at JSON.parse () at XMLHttpRequest.onLoad "

service:

emision(body): Observable<any> {
    let httpOptions = {
      headers: new HttpHeaders({
        
        'Authorization': "*********",
        'Action': "postproduct",
       
      })
    };
    return this.http.post('/api/******',
      body, httpOptions)
}



subscribe:

 this.mainService.emision(obj).subscribe(
                  (value) => {
                    console.log(value);
                   
                  },
                  (error) => {
                    console.log(error);
                    console.warn(
                      "ERROR CONEXION"
                    );
                  }
);


Although when I enter the console and then in network I can verify that the response is with status 200 and a response in xml format, when I want to catch the response it generates an httpResponseError with the following message "SyntaxError: Unexpected token <in JSON at position 0 at JSON.parse () at XMLHttpRequest.onLoad "

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda